﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace GuanYijia.EntityFarmeworkCore.Migrations
{
    public partial class log15 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<string>(
                name: "remark",
                table: "ProductionTaskItems",
                type: "varchar(500)",
                maxLength: 500,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<string>(
                name: "remark",
                table: "ProductionTaskHeads",
                type: "varchar(500)",
                maxLength: 500,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "longtext")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<decimal>(
                name: "production_quantity",
                table: "ProductionTaskHeads",
                type: "decimal(24,6)",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.AlterColumn<decimal>(
                name: "order_quantity",
                table: "ProductionTaskHeads",
                type: "decimal(24,6)",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.AlterColumn<string>(
                name: "head_no",
                table: "ProductionTaskHeads",
                type: "varchar(50)",
                maxLength: 50,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "longtext")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<decimal>(
                name: "bom_allPrice",
                table: "ProductionTaskHeads",
                type: "decimal(24,6)",
                nullable: false,
                defaultValue: 0m);

            migrationBuilder.AddColumn<decimal>(
                name: "bom_quantity",
                table: "ProductionTaskHeads",
                type: "decimal(24,6)",
                nullable: false,
                defaultValue: 0m);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "bom_allPrice",
                table: "ProductionTaskHeads");

            migrationBuilder.DropColumn(
                name: "bom_quantity",
                table: "ProductionTaskHeads");

            migrationBuilder.AlterColumn<string>(
                name: "remark",
                table: "ProductionTaskItems",
                type: "longtext",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(500)",
                oldMaxLength: 500,
                oldNullable: true)
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.UpdateData(
                table: "ProductionTaskHeads",
                keyColumn: "remark",
                keyValue: null,
                column: "remark",
                value: "");

            migrationBuilder.AlterColumn<string>(
                name: "remark",
                table: "ProductionTaskHeads",
                type: "longtext",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(500)",
                oldMaxLength: 500,
                oldNullable: true)
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<int>(
                name: "production_quantity",
                table: "ProductionTaskHeads",
                type: "int",
                nullable: false,
                oldClrType: typeof(decimal),
                oldType: "decimal(24,6)");

            migrationBuilder.AlterColumn<int>(
                name: "order_quantity",
                table: "ProductionTaskHeads",
                type: "int",
                nullable: false,
                oldClrType: typeof(decimal),
                oldType: "decimal(24,6)");

            migrationBuilder.AlterColumn<string>(
                name: "head_no",
                table: "ProductionTaskHeads",
                type: "longtext",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(50)",
                oldMaxLength: 50)
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");
        }
    }
}
